package com.code.softeem.zuoye.demo2;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/20 17:02
 * @description
 */
public class Auto {
    private int ltgs;
    private String color;
    private double zhong;
    private double speed;

    public Auto(int ltgs, String color, double zhong, double speed) {
        this.ltgs = ltgs;
        this.color = color;
        this.zhong = zhong;
        this.speed = speed;
    }

    public Auto() {
    }

    public int getLtgs() {
        return ltgs;
    }

    public void setLtgs(int ltgs) {
        this.ltgs = ltgs;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getZhong() {
        return zhong;
    }

    public void setZhong(double zhong) {
        this.zhong = zhong;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public void speedUp(){
        speed+=10.0;
    }
    public void speedDown(){
        speed-=10.0;
    }
    public void getInfo(){
        System.out.println("这个"+ltgs+"轮"+zhong+"kg"+
                color+"的汽车正在以"+speed+"km/h的速度行驶");
    }


    @Override
    public String toString() {
        return "Auto{" +
                "ltgs=" + ltgs +
                ", color='" + color + '\'' +
                ", zhong=" + zhong +
                ", speed=" + speed +
                '}';
    }
}
